package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbItemCatMapper;
import com.dongdongshop.pojo.TbItemCat;
import com.dongdongshop.pojo.TbItemCatExample;
import com.dongdongshop.service.ItemCatService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@DubboService
public class ItemCatServiceImpl implements ItemCatService {

    @Resource
    private TbItemCatMapper itemCatMapper;

    @Override
    public List<TbItemCat> itemCatInfo(Long id) {
        return itemCatMapper.itemCatInfo(id);
    }

    @Override
    public int itemCatAdd(TbItemCat itemCat) {
        return itemCatMapper.insertSelective(itemCat);
    }

    @Override
    public TbItemCat getItemCatById(Long id) {
        return itemCatMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateItemCat(TbItemCat itemCat) {
        return itemCatMapper.updateByPrimaryKeySelective(itemCat);
    }

    @Override
    public int deleteId(Long id) {
        return itemCatMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<TbItemCat> findItemCatByParentId(Long id) {
        return itemCatMapper.itemCatInfo(id);
    }

    @Override
    public TbItemCat getInfoById(Long category1Id) {
        return itemCatMapper.selectByPrimaryKey(category1Id);
    }
}
